package day04;

public class ExtendPractice {
    public static void main(String[] args) {
        //1. 输出1900到2023年之间所有的闰年(每够10个年份，换一行)
        int count = 0;
        for(int years = 1900; years <= 2023;years++){
            if(years %4 == 0 && years %100 != 0 || years %400 == 0 ){
                System.out.print(years+"是闰年"+" ");
                count++;
                if(count %10 ==0 ){
                    System.out.println();
                }
            }
        }
        System.out.println();
        System.out.println("1900到2023年之间有"+count+"个闰年");

        //2. 利用for循环计算：求数字1到100之内，所有偶数的和，并输出
        int sum = 0 ;
        for (int num = 1; num <= 100; num++) {
            if(num %2 ==0){
                sum += num;
            }
        }
        System.out.println("sum="+sum);

        //3. 利用for循环计算：求8的阶乘，并输出
        int num = 1;
        for (int i = 1; i <= 8; i++) {
            num *= i;
        }
        System.out.println("num="+num);

        //4.用for循环计算：打印字符*组成的等腰三角形，输出结果如下所示：

            for(int num1 = 1; num1 <= 6;num1++){
                for(int i = 1; i <= 2*num1-1; i++){
                    System.out.print("*");
                }
                System.out.println();
            }





















    }
}
